package com.github.dreamyoung.mprelation.demo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.Lazy;
import com.github.dreamyoung.mprelation.OneToMany;
import com.github.dreamyoung.mprelation.OneToOne;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * @author lxl
 * @date 2022/4/10
 */
@Data
public class Grade {
    /**
     * 年级id
     */
    @TableId(value = "grade_id")
    private Integer id;
    /**
     * 年级名称
     */
    private String gradeName;
    /**
     * 一对多查询 （一个年级有多个学生）
     */
    @TableField(exist = false)
    @OneToMany
    @JoinColumn(name="grade_id",referencedColumnName = "grade_id")
    @Lazy(value = false)
    private List<Student> studentList;
}
